package com.jhws.core.mns.utils;

import com.aliyun.mns.client.CloudAccount;
import com.aliyun.mns.client.MNSClient;
import com.jhws.core.mns.bo.AliMNSConstant;

public class MNSClientUtils {
    private static MNSClientUtils instance;
    private MNSClient client;

    private MNSClientUtils() {
        CloudAccount account = new CloudAccount(AliMNSConstant.accessKeyID, AliMNSConstant.accessKeySecret, AliMNSConstant.endpoint);
        client = account.getMNSClient(); // 在程序中，CloudAccount以及MNSClient单例实现即可，多线程安全
    }

    public static MNSClientUtils instance() {
        if (instance == null) {
            instance = new MNSClientUtils();
        }
        return instance;
    }

    public MNSClient getClient() {
        return client;
    }
}
